import http from '@/utils/http'
/**
 *  返回的Promise<{
 *  ret: 0 | 1, 0-成功 1-失败
 *  data: T,
 *  msg: string
 *  }>
 */

/**
 * 创建工单
 * @param params
 * @returns
 */
export function disposeOrderCreate(params) {
  return http.post('/order/create', params, {
    showLoading: true,
    showErrorToast: true,
    headers: {
      'Content-Type': 'application/json'
    }
  })
}

/**
 * 获取工单数据来源
 * @param params
 * @returns
 */
export function getSourceLevel2(params) {
  return http.get('/dictionary/treeGroup?dictGroup=dispose_source_type', {
    params,
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 获取舆情类别
 * @param params
 * @returns
 */
export function getInfoType(params) {
  return http.get('/order/info-type', {
    params,
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 督办列表
 * @param params
 * @returns
 */
export function getPageSuperviseApi(params) {
  return http.get('/tio/pageSupervise', {
    params,
    showLoading: true,
    showErrorToast: true
  })
}



/**
 * 查询用获取州市、处室或单位
 * @name getDisposeOrderFilterOrg
 * @param params
 * @returns
 */
export function getDisposeOrderFilterOrg(params) {
  return http.get('/order/filter-org', {
    params,
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 获取州市、处室或单位 ---分发单位
 * @name getOrganizationList
 * @param params
 * @returns
 */
export function getOrganizationList(params) {
  return http.get('/order/distribute-org', {
    params,
    showLoading: true,
    showErrorToast: true
  })
}


/**
 * 舆情级别
 * @param params
 * @returns
 */
 export function getLevelApi(params) {
  return http.get('/order/info-level', {
    params,
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 来源类型
 * @param params
 * @returns
 */
export function getSourceTypeApi(params) {
  return http.get('/order/source-type', {
    params,
    showLoading: true,
    showErrorToast: true
  })
}


/**
 * 获取工单列表
 * @name getDisposeOrderList
 * @param params
 * @returns
 */
export function getDisposeOrderList(params) {
  return http.post('/order/page', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 获取单条工单详情
 * @param params
 * @returns
 */
export function getDisposeOrderDetail(params) {
  return http.get('/order/detail', {
    params,
    showLoading: true,
    showErrorToast: !params.auditId
  })
}

/**
 * 工单分发
 * @name disposeOrderDistribute
 * @param params
 * @returns
 */
export function disposeOrderDistribute(params) {
  return http.post('/order/distribute', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单核查反馈
 * @name disposeOrderCheckResponse
 * @param params
 * @returns
 */
export function disposeOrderCheckResponse(params) {
  return http.post('/order/checkResponse', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单处置
 * @name disposeOrderDispose
 * @param params
 * @returns
 */
export function disposeOrderDispose(params) {
  return http.post('/order/dispose', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单 - 查询督办单位
 * @name disposeOrderListCanBeSupervised
 * @param params
 * @returns
 */
export function disposeOrderListCanBeSupervised(params) {
  return http.get('/order/listCanBeSupervised', {
    params,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单 - 工单督办
 * @name disposeOrderSupervise
 * @param params
 * @returns
 */
export function disposeOrderSupervise(params) {
  return http.post('/order/supervise', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单 - 督办反馈
 * @name disposeOrderFeedback
 * @param params
 * @returns
 */
export function disposeOrderFeedback(params) {
  return http.post('/order/feedback', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单 - 工单上报
 * @name disposeOrderBack
 * @param params
 * @returns
 */
export function disposeOrderBack(params) {
  return http.post('/order/back', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单 - 审核
 * @name disposeOrderAudit
 * @param params
 * @returns
 */
export function disposeOrderAudit(params) {
  return http.post('/order/audit', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单 - 撤销
 * @name disposeOrderCancel
 * @param params
 * @returns
 */
export function disposeOrderCancel(params) {
  return http.post('/order/cancel', params, {
    showLoading: true,
    showErrorToast: true,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 工单 - 补充处置
 * @name disposeOrderAddition
 * @param params
 * @returns
 */
export function disposeOrderAddition(params) {
  return http.post('/order/addition', params, {
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单详情 - 处置结果
 * @name disposeOrderHandelDetail
 * @param params
 * @returns
 */
export function disposeOrderHandelDetail(params) {
  return http.get('/order/handelDetail', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    params,
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单详情 - 处置流程
 * @name disposeOrderProcessDetail
 * @param params
 * @returns
 */
export function disposeOrderProcessDetail(params) {
  return http.get('/order/processDetail', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    params,
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单详情 - 督办详情
 * @name disposeOrderSuperviseDetail
 * @param params
 * @returns
 */
export function disposeOrderSuperviseDetail(params) {
  return http.get('/order/superviseDetail', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    params,
    showLoading: true,
    showErrorToast: true
  })
}

/**
 * 工单 - 发布人已删除 1 or 0
 * @name postSourceDelete
 * @param params
 * @returns
 */
export function postSourceDelete(params) {
  return http.post('/order/sourceDelete', params, {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    showLoading: true,
    showErrorToast: true
  })
}

